﻿using Hinacom.Scheduler.Service;
using System;
using System.IO;
using System.ServiceModel;

namespace Hinacom.Scheduler.Hosts.ConsoleApp
{
    class Program
    {
        private static SchedulerService service;

        static void Main(string[] args)
        {
            Directory.SetCurrentDirectory(System.AppDomain.CurrentDomain.BaseDirectory);

            service = new SchedulerService();
            service.Initialize();
            service.Start();

            ServiceHost host = new ServiceHost(service);
            host.Open();

            Console.WriteLine("");
            Console.WriteLine("Scheduler Service is running at " + host.BaseAddresses[0].ToString() + ".");
            Console.WriteLine("Press any key to terminate.");
            Console.ReadLine();

            service.Stop();
            host.Close();
        }
    }
}
